//
// CTessFace.java
// Copyright (C) 2010  "Naush" <naush _ hotmail _ fr>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>./* ----------------------------------------------------------------------------







package org.ryzom.nel.threed;

import org.ryzom.nel.misc.CUV;
import org.ryzom.nel.misc.CVector;

public class CTessFace extends CTessNodeList {
  private long swigCPtr;

  public CTessFace(long cPtr, boolean cMemoryOwn) {
    super(nel3dJNI.CTessFace_SWIGUpcast(cPtr), cMemoryOwn);
    swigCPtr = cPtr;
  }

  public static long getCPtr(CTessFace obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nel3dJNI.delete_CTessFace(swigCPtr);
      }
      swigCPtr = 0;
    }
    super.delete();
  }

  public void setPatch(CPatch value) {
    nel3dJNI.CTessFace_Patch_set(swigCPtr, this, CPatch.getCPtr(value), value);
  }

  public CPatch getPatch() {
    long cPtr = nel3dJNI.CTessFace_Patch_get(swigCPtr, this);
    return (cPtr == 0) ? null : new CPatch(cPtr, false);
  }

  public void setVBase(CTessVertex value) {
    nel3dJNI.CTessFace_VBase_set(swigCPtr, this, CTessVertex.getCPtr(value), value);
  }

  public CTessVertex getVBase() {
    long cPtr = nel3dJNI.CTessFace_VBase_get(swigCPtr, this);
    return (cPtr == 0) ? null : new CTessVertex(cPtr, false);
  }

  public void setVLeft(CTessVertex value) {
    nel3dJNI.CTessFace_VLeft_set(swigCPtr, this, CTessVertex.getCPtr(value), value);
  }

  public CTessVertex getVLeft() {
    long cPtr = nel3dJNI.CTessFace_VLeft_get(swigCPtr, this);
    return (cPtr == 0) ? null : new CTessVertex(cPtr, false);
  }

  public void setVRight(CTessVertex value) {
    nel3dJNI.CTessFace_VRight_set(swigCPtr, this, CTessVertex.getCPtr(value), value);
  }

  public CTessVertex getVRight() {
    long cPtr = nel3dJNI.CTessFace_VRight_get(swigCPtr, this);
    return (cPtr == 0) ? null : new CTessVertex(cPtr, false);
  }

  public void setFBase(CTessFace value) {
    nel3dJNI.CTessFace_FBase_set(swigCPtr, this, CTessFace.getCPtr(value), value);
  }

  public CTessFace getFBase() {
    long cPtr = nel3dJNI.CTessFace_FBase_get(swigCPtr, this);
    return (cPtr == 0) ? null : new CTessFace(cPtr, false);
  }

  public void setFLeft(CTessFace value) {
    nel3dJNI.CTessFace_FLeft_set(swigCPtr, this, CTessFace.getCPtr(value), value);
  }

  public CTessFace getFLeft() {
    long cPtr = nel3dJNI.CTessFace_FLeft_get(swigCPtr, this);
    return (cPtr == 0) ? null : new CTessFace(cPtr, false);
  }

  public void setFRight(CTessFace value) {
    nel3dJNI.CTessFace_FRight_set(swigCPtr, this, CTessFace.getCPtr(value), value);
  }

  public CTessFace getFRight() {
    long cPtr = nel3dJNI.CTessFace_FRight_get(swigCPtr, this);
    return (cPtr == 0) ? null : new CTessFace(cPtr, false);
  }

  public void setFather(CTessFace value) {
    nel3dJNI.CTessFace_Father_set(swigCPtr, this, CTessFace.getCPtr(value), value);
  }

  public CTessFace getFather() {
    long cPtr = nel3dJNI.CTessFace_Father_get(swigCPtr, this);
    return (cPtr == 0) ? null : new CTessFace(cPtr, false);
  }

  public void setSonLeft(CTessFace value) {
    nel3dJNI.CTessFace_SonLeft_set(swigCPtr, this, CTessFace.getCPtr(value), value);
  }

  public CTessFace getSonLeft() {
    long cPtr = nel3dJNI.CTessFace_SonLeft_get(swigCPtr, this);
    return (cPtr == 0) ? null : new CTessFace(cPtr, false);
  }

  public void setSonRight(CTessFace value) {
    nel3dJNI.CTessFace_SonRight_set(swigCPtr, this, CTessFace.getCPtr(value), value);
  }

  public CTessFace getSonRight() {
    long cPtr = nel3dJNI.CTessFace_SonRight_get(swigCPtr, this);
    return (cPtr == 0) ? null : new CTessFace(cPtr, false);
  }

  public void setPVBase(CParamCoord value) {
    nel3dJNI.CTessFace_PVBase_set(swigCPtr, this, CParamCoord.getCPtr(value), value);
  }

  public CParamCoord getPVBase() {
    long cPtr = nel3dJNI.CTessFace_PVBase_get(swigCPtr, this);
    return (cPtr == 0) ? null : new CParamCoord(cPtr, false);
  }

  public void setPVLeft(CParamCoord value) {
    nel3dJNI.CTessFace_PVLeft_set(swigCPtr, this, CParamCoord.getCPtr(value), value);
  }

  public CParamCoord getPVLeft() {
    long cPtr = nel3dJNI.CTessFace_PVLeft_get(swigCPtr, this);
    return (cPtr == 0) ? null : new CParamCoord(cPtr, false);
  }

  public void setPVRight(CParamCoord value) {
    nel3dJNI.CTessFace_PVRight_set(swigCPtr, this, CParamCoord.getCPtr(value), value);
  }

  public CParamCoord getPVRight() {
    long cPtr = nel3dJNI.CTessFace_PVRight_get(swigCPtr, this);
    return (cPtr == 0) ? null : new CParamCoord(cPtr, false);
  }

  public void setLevel(short value) {
    nel3dJNI.CTessFace_Level_set(swigCPtr, this, value);
  }

  public short getLevel() {
    return nel3dJNI.CTessFace_Level_get(swigCPtr, this);
  }

  public void setRecursMarkCanMerge(boolean value) {
    nel3dJNI.CTessFace_RecursMarkCanMerge_set(swigCPtr, this, value);
  }

  public boolean getRecursMarkCanMerge() {
    return nel3dJNI.CTessFace_RecursMarkCanMerge_get(swigCPtr, this);
  }

  public void setRecursMarkForceMerge(boolean value) {
    nel3dJNI.CTessFace_RecursMarkForceMerge_set(swigCPtr, this, value);
  }

  public boolean getRecursMarkForceMerge() {
    return nel3dJNI.CTessFace_RecursMarkForceMerge_get(swigCPtr, this);
  }

  public void setTileId(short value) {
    nel3dJNI.CTessFace_TileId_set(swigCPtr, this, value);
  }

  public short getTileId() {
    return nel3dJNI.CTessFace_TileId_get(swigCPtr, this);
  }

  public void setTileMaterial(CTileMaterial value) {
    nel3dJNI.CTessFace_TileMaterial_set(swigCPtr, this, CTileMaterial.getCPtr(value), value);
  }

  public CTileMaterial getTileMaterial() {
    long cPtr = nel3dJNI.CTessFace_TileMaterial_get(swigCPtr, this);
    return (cPtr == 0) ? null : new CTileMaterial(cPtr, false);
  }

  public void setTileFaces(SWIGTYPE_p_p_NL3D__CTileFace value) {
    nel3dJNI.CTessFace_TileFaces_set(swigCPtr, this, SWIGTYPE_p_p_NL3D__CTileFace.getCPtr(value));
  }

  public SWIGTYPE_p_p_NL3D__CTileFace getTileFaces() {
    long cPtr = nel3dJNI.CTessFace_TileFaces_get(swigCPtr, this);
    return (cPtr == 0) ? null : new SWIGTYPE_p_p_NL3D__CTileFace(cPtr, false);
  }

  public void setErrorMetricDate(int value) {
    nel3dJNI.CTessFace_ErrorMetricDate_set(swigCPtr, this, value);
  }

  public int getErrorMetricDate() {
    return nel3dJNI.CTessFace_ErrorMetricDate_get(swigCPtr, this);
  }

  public void setSize(float value) {
    nel3dJNI.CTessFace_Size_set(swigCPtr, this, value);
  }

  public float getSize() {
    return nel3dJNI.CTessFace_Size_get(swigCPtr, this);
  }

  public void setSplitPoint(CVector value) {
    nel3dJNI.CTessFace_SplitPoint_set(swigCPtr, this, CVector.getCPtr(value), value);
  }

  public CVector getSplitPoint() {
    long cPtr = nel3dJNI.CTessFace_SplitPoint_get(swigCPtr, this);
    return (cPtr == 0) ? null : new CVector(cPtr, false);
  }

  public void setErrorMetric(float value) {
    nel3dJNI.CTessFace_ErrorMetric_set(swigCPtr, this, value);
  }

  public float getErrorMetric() {
    return nel3dJNI.CTessFace_ErrorMetric_get(swigCPtr, this);
  }

  public void setMaxDistToSplitPoint(float value) {
    nel3dJNI.CTessFace_MaxDistToSplitPoint_set(swigCPtr, this, value);
  }

  public float getMaxDistToSplitPoint() {
    return nel3dJNI.CTessFace_MaxDistToSplitPoint_get(swigCPtr, this);
  }

  public void setFVBase(CTessFarVertex value) {
    nel3dJNI.CTessFace_FVBase_set(swigCPtr, this, CTessFarVertex.getCPtr(value), value);
  }

  public CTessFarVertex getFVBase() {
    long cPtr = nel3dJNI.CTessFace_FVBase_get(swigCPtr, this);
    return (cPtr == 0) ? null : new CTessFarVertex(cPtr, false);
  }

  public void setFVLeft(CTessFarVertex value) {
    nel3dJNI.CTessFace_FVLeft_set(swigCPtr, this, CTessFarVertex.getCPtr(value), value);
  }

  public CTessFarVertex getFVLeft() {
    long cPtr = nel3dJNI.CTessFace_FVLeft_get(swigCPtr, this);
    return (cPtr == 0) ? null : new CTessFarVertex(cPtr, false);
  }

  public void setFVRight(CTessFarVertex value) {
    nel3dJNI.CTessFace_FVRight_set(swigCPtr, this, CTessFarVertex.getCPtr(value), value);
  }

  public CTessFarVertex getFVRight() {
    long cPtr = nel3dJNI.CTessFace_FVRight_get(swigCPtr, this);
    return (cPtr == 0) ? null : new CTessFarVertex(cPtr, false);
  }

  public void setShadowMapTriId(int value) {
    nel3dJNI.CTessFace_ShadowMapTriId_set(swigCPtr, this, value);
  }

  public int getShadowMapTriId() {
    return nel3dJNI.CTessFace_ShadowMapTriId_get(swigCPtr, this);
  }

  public CTessFace() {
    this(nel3dJNI.new_CTessFace(), true);
  }

  public boolean isLeaf() {
    return nel3dJNI.CTessFace_isLeaf(swigCPtr, this);
  }

  public boolean isRectangular() {
    return nel3dJNI.CTessFace_isRectangular(swigCPtr, this);
  }

  public boolean hasVertex(CTessVertex v) {
    return nel3dJNI.CTessFace_hasVertex(swigCPtr, this, CTessVertex.getCPtr(v), v);
  }

  public boolean hasEdge(CTessVertex v0, CTessVertex v1) {
    return nel3dJNI.CTessFace_hasEdge(swigCPtr, this, CTessVertex.getCPtr(v0), v0, CTessVertex.getCPtr(v1), v1);
  }

  public void changeNeighbor(CTessFace from, CTessFace to) {
    nel3dJNI.CTessFace_changeNeighbor(swigCPtr, this, CTessFace.getCPtr(from), from, CTessFace.getCPtr(to), to);
  }

  public void computeTileMaterial() {
    nel3dJNI.CTessFace_computeTileMaterial(swigCPtr, this);
  }

  public void releaseTileMaterial() {
    nel3dJNI.CTessFace_releaseTileMaterial(swigCPtr, this);
  }

  public float computeNearLimit() {
    return nel3dJNI.CTessFace_computeNearLimit(swigCPtr, this);
  }

  public void updateErrorMetric() {
    nel3dJNI.CTessFace_updateErrorMetric(swigCPtr, this);
  }

  public void split(boolean propagateSplit) {
    nel3dJNI.CTessFace_split__SWIG_0(swigCPtr, this, propagateSplit);
  }

  public void split() {
    nel3dJNI.CTessFace_split__SWIG_1(swigCPtr, this);
  }

  public boolean merge() {
    return nel3dJNI.CTessFace_merge(swigCPtr, this);
  }

  public void refineAll() {
    nel3dJNI.CTessFace_refineAll(swigCPtr, this);
  }

  public void updateRefineSplit() {
    nel3dJNI.CTessFace_updateRefineSplit(swigCPtr, this);
  }

  public void updateRefineMerge() {
    nel3dJNI.CTessFace_updateRefineMerge(swigCPtr, this);
  }

  public void computeSplitPoint() {
    nel3dJNI.CTessFace_computeSplitPoint(swigCPtr, this);
  }

  public void unbind() {
    nel3dJNI.CTessFace_unbind(swigCPtr, this);
  }

  public void forceMerge() {
    nel3dJNI.CTessFace_forceMerge(swigCPtr, this);
  }

  public CTessFace linkTessFaceWithEdge(SWIGTYPE_p_NLMISC__CVector2f uv0, SWIGTYPE_p_NLMISC__CVector2f uv1, CTessFace linkTo) {
    long cPtr = nel3dJNI.CTessFace_linkTessFaceWithEdge(swigCPtr, this, SWIGTYPE_p_NLMISC__CVector2f.getCPtr(uv0), SWIGTYPE_p_NLMISC__CVector2f.getCPtr(uv1), CTessFace.getCPtr(linkTo), linkTo);
    return (cPtr == 0) ? null : new CTessFace(cPtr, false);
  }

  public boolean updateBindEdge(SWIGTYPE_p_p_NL3D__CTessFace edgeFace, SWIGTYPE_p_bool splitWanted) {
    return nel3dJNI.CTessFace_updateBindEdge(swigCPtr, this, SWIGTYPE_p_p_NL3D__CTessFace.getCPtr(edgeFace), SWIGTYPE_p_bool.getCPtr(splitWanted));
  }

  public void updateBind() {
    nel3dJNI.CTessFace_updateBind(swigCPtr, this);
  }

  public void updateBindAndSplit() {
    nel3dJNI.CTessFace_updateBindAndSplit(swigCPtr, this);
  }

  public void forceMergeAtTileLevel() {
    nel3dJNI.CTessFace_forceMergeAtTileLevel(swigCPtr, this);
  }

  public void averageTesselationVertices() {
    nel3dJNI.CTessFace_averageTesselationVertices(swigCPtr, this);
  }

  public void refreshTesselationGeometry() {
    nel3dJNI.CTessFace_refreshTesselationGeometry(swigCPtr, this);
  }

  public void deleteTileUvs() {
    nel3dJNI.CTessFace_deleteTileUvs(swigCPtr, this);
  }

  public void recreateTileUvs() {
    nel3dJNI.CTessFace_recreateTileUvs(swigCPtr, this);
  }

  public void getTesselatedPos(CUV uv, boolean verifInclusion, CVector ret) {
    nel3dJNI.CTessFace_getTesselatedPos(swigCPtr, this, CUV.getCPtr(uv), uv, verifInclusion, CVector.getCPtr(ret), ret);
  }

  public void appendTessellationLeaves(SWIGTYPE_p_std__vectorT_NL3D__CTessFace_const_p_t leaves) {
    nel3dJNI.CTessFace_appendTessellationLeaves(swigCPtr, this, SWIGTYPE_p_std__vectorT_NL3D__CTessFace_const_p_t.getCPtr(leaves));
  }

  public static void setMultipleBindFace(CTessFace value) {
    nel3dJNI.CTessFace_MultipleBindFace_set(CTessFace.getCPtr(value), value);
  }

  public static CTessFace getMultipleBindFace() {
    long cPtr = nel3dJNI.CTessFace_MultipleBindFace_get();
    return (cPtr == 0) ? null : new CTessFace(cPtr, false);
  }

  public final static class TTileUvId {
    public final static TTileUvId IdUvBase = new TTileUvId("IdUvBase", nel3dJNI.CTessFace_IdUvBase_get());
    public final static TTileUvId IdUvLeft = new TTileUvId("IdUvLeft");
    public final static TTileUvId IdUvRight = new TTileUvId("IdUvRight");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static TTileUvId swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + TTileUvId.class + " with value " + swigValue);
    }

    private TTileUvId(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private TTileUvId(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private TTileUvId(String swigName, TTileUvId swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static TTileUvId[] swigValues = { IdUvBase, IdUvLeft, IdUvRight };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

}
